package controller

import (
	"gin/response"
	"gin/service"
	"gin/types"
	"github.com/gin-gonic/gin"
)

type NoteEntityRelation struct {
}

var (
	noteEntityRelationService service.NoteEntityRelation
)

// 获取资产关联的镜头列表
func (c *NoteEntityRelation) GetAssetFeedbackAffectedShotCount(ctx *gin.Context) {
	var req types.GetAssetFeedbackAffectedShotCountReq
	err := ctx.ShouldBindJSON(&req)
	if err != nil {
		response.Fail(ctx, nil, err.Error())
		return
	}

	var resData interface{}
	resData, queryErr := noteEntityRelationService.GetAssetFeedbackAffectedShotCount(req.ReviewFeedbackId)
	if queryErr != nil {
		// 查询失败
		response.Fail(ctx, nil, queryErr.Error())
	} else {
		// 查询成功
		response.Success(ctx, gin.H{"data": resData}, "success")
	}
}

// 获取镜头反馈工序上百分比
func (c *NoteEntityRelation) GetShotFeedbackStepCategoryCount(ctx *gin.Context) {
	var req types.GetShotFeedbackStepCategoryCountReq
	err := ctx.ShouldBindJSON(&req)
	if err != nil {
		response.Fail(ctx, nil, err.Error())
		return
	}

	var resData interface{}
	resData, queryErr := noteEntityRelationService.GetShotFeedbackStepCategoryCount(req.ReviewFeedbackId, req.ProjectId, req.InitEpisodeCodes)
	if queryErr != nil {
		// 查询失败
		response.Fail(ctx, nil, queryErr.Error())
	} else {
		// 查询成功
		response.Success(ctx, gin.H{"data": resData}, "success")
	}
}
